package test.com.sms.selenium.singlepoint.util;

import java.util.Set;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpCommonAssertSearchPageUtil extends SeleniumPageUtil {

	public final static By CAS_TD_TOP_TITLE 			= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[1]/tbody/tr/td[2]");
	public final static By CAS_TD_STATUS_CODES 			= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[1]");
	public final static By CAS_CHECKBOX_ACTIVE 			= By.id("ctl44_chkActive");
	public final static By CAS_LABEL_ACTIVE 			= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[2]/label[1]");
	public final static By CAS_CHECKBOX_INACTIVE 		= By.id("ctl44_chkInactive");
	public final static By CAS_LABEL_INACTIVE			= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[2]/label[2]");
	public final static By CAS_CHECKBOX_PENDING 		= By.id("ctl44_chkPending");
	public final static By CAS_LABEL_PENDING 			= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[2]/label[3]");
	public final static By CAS_CHECKBOX_RETIRED 		= By.id("ctl44_chkRetired");
	public final static By CAS_LABEL_RETIRED 			= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[2]/label[4]");
	public final static By CAS_CHECKBOX_OUTOFSERVICE 	= By.id("ctl44_chkOutOfService");
	public final static By CAS_LABEL_OUTOFSERVICE 		= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[2]/label[5]");
	public final static By CAS_TD_SERRCH_IN 			= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[3]/tbody/tr/td[1]");
	public final static By CAS_RADIO_CUSTOMER 			= By.id("ctl44_rdoCustomer");
	public final static By CAS_SPAN_CUSTOMER 			= By.id("ctl44_lblCustomerName");
	public final static By CAS_RADIO_ALL_CUSTOMERS 		= By.id("ctl44_rdoAllCustomers");
	public final static By CAS_SPAN_ALL_CUSTOMERS 		= By.id("ctl44_lblAllCustomers");
	public final static By CAS_TD_ASSET_NAME 			= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[1]/td[1]");
	public final static By CAS_INPUT_ASSET_NAME 		= By.id("ctl44_txtAssetName");
	public final static By CAS_TD_ASSET_TYPE 			= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[1]/td[3]");
	public final static By CAS_SELECT_ASSET_TYPE 		= By.id("ctl44_cboAssetTypeID");
	public final static By CAS_TD_SUB_TYPE 				= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[1]/td[5]");
	public final static By CAS_SELECT_SUB_TYPE 			= By.id("ctl44_cboAssetSubTypeID");
	public final static By CAS_TD_SERIAL 				= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[2]/td[1]");
	public final static By CAS_INPUT_SERIAL_SUM 		= By.id("ctl44_txtSerialNum");
	public final static By CAS_TD_MFG_CODE 				= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[2]/td[3]");
	public final static By CAS_SELECT_MDF_CODE 			= By.id("ctl44_cboMfgCodeID");
	public final static By CAS_TD_MODEL_CODE 			= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[2]/td[5]");
	public final static By CAS_SELECT_MODEL_CODE 		= By.id("ctl44_lstModelCodeID");
	public final static By CAS_TD_ASSET_GROUP 			= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[3]/td[1]");
	public final static By CAS_SELECT_ASSET_GROUP 		= By.id("ctl44_cboAssetGroupID");
	public final static By CAS_TD_ADD_NAME 				= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[4]/td[1]");
	public final static By CAS_SELECT_ADD_NAME 			= By.id("ctl44_cboAddressID");
	public final static By CAS_SPAN_LOCATION_ID 		= By.id("ctl44_lblLocationID");
	public final static By CAS_SELECT_LOCATION_ID 		= By.id("ctl44_cboLocationID");
	public final static By CAS_TD_OTHER_FIELDID 		= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[5]/td/table/tbody/tr/td[1]");
	public final static By CAS_SELECT_OTHER_FIELDID 	= By.id("ctl44_OtherSearch1_cboOther");
	public final static By CAS_SPAN_OTHER_VALUES 		= By.id("ctl44_OtherSearch1_lblOther");
	public final static By CAS_INPUT_OTHER_VALUES 		= By.id("ctl44_OtherSearch1_txtOtherText");
	public final static By CAS_CHECKBOX_OTHER_VALUES 	= By.id("ctl44_OtherSearch1_chkOther");
	public final static By CAS_TD_USER_FORM 			= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[6]/td[1]");
	public final static By CAS_SELECT_USER_FORM 		= By.id("ctl44_cboUdfID");
	public final static By CAS_TD_FIELD 				= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[6]/td[3]");
	public final static By CAS_SELECT_FIELD 			= By.id("ctl44_cboUdfFieldID");
	public final static By CAS_TD_VALUE 				= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[6]/td[5]");
	public final static By CAS_SELECT_VALUE 			= By.id("ctl44_cboAnswers");
	public final static By CAS_SUBMIT_SEARCH 			= By.id("ctl44_btnSearch");
	public final static By CAS_SUBMIT_CLEAR 			= By.id("ctl44_btnClear");
	public final static By CAS_SUBMIT_CLOSE 			= By.id("ctl44_btnClose");
	
	public static void enter(){
		SpHomePageUtil.enter();
		SpHomePageUtil.enterNewTicketPage();
		Set<String> before = SeleniumUtil.getWindowHandles();
		SeleniumUtil.click(SeleniumUtil.getCachedElement(SpNewTicketPageUtil.NEW_TICKET_BUTTON_SEARCH_ASSET));
		SeleniumUtil.waitForFixedMilliseconds(1000);
		SeleniumUtil.switchToPromptedWindow(before, SeleniumUtil.getWindowHandles());
		waitForPageToLoad();
	}
	public static void waitForPageToLoad(){
		//asset search page in content area
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.waitOnElements(new By[]{
				CAS_SELECT_ASSET_TYPE,CAS_SELECT_SUB_TYPE,CAS_SELECT_MDF_CODE,CAS_SELECT_MODEL_CODE,CAS_SELECT_ASSET_GROUP,
				CAS_SELECT_ADD_NAME,CAS_SELECT_LOCATION_ID,CAS_SELECT_OTHER_FIELDID,CAS_SELECT_USER_FORM,CAS_SELECT_VALUE,
				CAS_SELECT_FIELD
			});
	}
}
